
{% extends 'authuser/base.html' %}
{% block content %}

<script src="https://cdn.bootcss.com/nice-validator/1.1.3/jquery.validator.min.js?local=zh-CN"></script>
<link href="https://cdn.bootcss.com/nice-validator/1.1.3/jquery.validator.min.css" rel="stylesheet">
<script src="{{ js_config.js_lib.jb_admin_pack_js }}"></script>
<script src="{{ js_config.js_lib.layer }}"></script>

<style type="text/css" media="screen" id="test">
	.warn{
		color: red;
	}
</style>

<script type="text/javascript">
	next="{{next |default:'/'}}"
	login_url='{{login_url}}'
	
	heads = {{heads | safe}}
	fix = [{name:'username',autofocus:true,label:'用户名'},
			{name:'password',label:'密码',type:'password'},
			{name:'pas2',label:'确认密码',type:'password'}]
//	merge(heads,fix)
	
	$(function () {
		new Vue({
			el:'#content',
			data:{
				heads:heads,
				row:{},
//				kw:{
//					errors:{},
//					row:{
//						username:'',
//						password:'',
//						pas2:'',
//					},
//					heads: heads
//				},
				
			},
			mixins:[mix_fields_data,mix_nice_validator],
			methods:{
				submit_info:function () {
					var self=this;
					var post_data={
						registe:{info:this.kw.row}
					}
					$.post('',JSON.stringify(post_data),function (data) {
						if(data.registe.errors){
							update_vue_obj(self.kw.errors,data.registe.errors)
						}else{
							var next=ex.parseSearch().next
							location=ex.appendSearch(login_url,{next:next}) ;
						}
					})
				}
			}
		})
	})
	
	
</script>

<div class='container' id='content'>
	<div ng-controller='content'>

	<!--<div name="regForm" class='form-signin'>-->
		<h2 class='form-signin-heading'>用户注册</h2>

		<div name="regForm" class='field-panel suit'>
			<field v-for="head in heads" :head='head' :row="row"></field>
		<!--<field name='password' :kw='kw'></field>-->
		<!--<field name='pas2' :kw='kw'>-->
			<!--<span>防止密码输错，所以请第二次输出相同的密码</span>-->
		<!--</field>-->
		
		<button name="test" type="button" value="val" 
			class='btn btn-lg btn-primary btn-block'
			@click='submit_info()'>注册</button>
		
	</div>

	<!--<div id='stdout' ng-bind='stdout' class='form-signin' style='color:red'></div>-->
	<!--<div auto-hide data='stdout' class='form-signin' style='color:red'></div>-->
</div>

</div>
<style type="text/css">
	.form-signin{
		max-width:330px;
		padding: 15px;
		margin: 0 auto;
	}
	input{
		margin-bottom:3px;
	}
</style>

{% endblock %}